﻿<UserControl
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" x:Name="userControl" x:Class="EzDesk.DesktopClient.View.TodoView"
             mc:Ignorable="d" 
             d:DesignHeight="200" d:DesignWidth="600"
             Visibility="{Binding IsVisible}" Width="250" Height="160">
    <UserControl.Resources>
    	<Style  TargetType="{x:Type Image}" x:Key="FeedReadStatusStyle">
    		<Setter Property="Source" Value="{StaticResource FeedNonRead}"/>
    		<Style.Triggers>
    			<DataTrigger Binding="{Binding CurrentNotification.IsRead, IsAsync=False, Mode=OneWay}" Value="True">
    				<Setter Property="Source" Value="{StaticResource FeedIsRead}"/>
    			</DataTrigger>
    		</Style.Triggers>
    	</Style>
    </UserControl.Resources>
    <Border  BorderThickness="1" Background="White" CornerRadius="2" BorderBrush="#FF999999" >
    	<VisualStateManager.VisualStateGroups>
    		<VisualStateGroup x:Name="ExpansionStates">
    			<VisualStateGroup.Transitions>
    				<VisualTransition GeneratedDuration="0:0:0.2">
    					<VisualTransition.GeneratedEasingFunction>
    						<CircleEase EasingMode="EaseIn"/>
    					</VisualTransition.GeneratedEasingFunction>
    				</VisualTransition>
    				<VisualTransition From="NormalState" GeneratedDuration="0:0:0.2" To="ExpandedState">
    					<Storyboard>
    						<DoubleAnimation BeginTime="0:0:0.2" Duration="0:0:0.2" To="650" Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="userControl"/>
    					</Storyboard>
    				</VisualTransition>
    			</VisualStateGroup.Transitions>
    			<VisualState x:Name="NormalState"/>
    			<VisualState x:Name="ExpandedState">
    				<Storyboard>
    					<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="userControl">
    						<EasingDoubleKeyFrame KeyTime="0" Value="650"/>
    					</DoubleAnimationUsingKeyFrames>
    				</Storyboard>
    			</VisualState>
    		</VisualStateGroup>
    	</VisualStateManager.VisualStateGroups>
    	<Border.Style>
            <Style TargetType="{x:Type Border}">
                <Style.Triggers>
                	<Trigger Property="IsMouseOver" Value="True">
                		<Setter Property="Background" Value="{StaticResource SelectedBackgroundBrush}"/>
                	</Trigger>
                </Style.Triggers>
            </Style>
        </Border.Style>
    	<i:Interaction.Behaviors>
    		<ei:DataStateBehavior Binding="{Binding IsExpanded}" Value="true" TrueState="ExpandedState" FalseState="NormalState"/>
    	</i:Interaction.Behaviors>
    	<i:Interaction.Triggers>
    		<ei:PropertyChangedTrigger Binding="{Binding IsExpanded}">
    			<i:Interaction.Behaviors>
    				<ei:ConditionBehavior>
    					<ei:ConditionalExpression>
    						<ei:ComparisonCondition LeftOperand="{Binding IsExpanded}" RightOperand="true"/>
    					</ei:ConditionalExpression>
    				</ei:ConditionBehavior>
    			</i:Interaction.Behaviors>
    			<ei:GoToStateAction TargetObject="{Binding ElementName=button}" StateName="LessState"/>
    		</ei:PropertyChangedTrigger>
    		<ei:PropertyChangedTrigger Binding="{Binding IsExpanded}">
    			<i:Interaction.Behaviors>
    				<ei:ConditionBehavior>
    					<ei:ConditionalExpression>
    						<ei:ComparisonCondition LeftOperand="{Binding IsExpanded}" RightOperand="false"/>
    					</ei:ConditionalExpression>
    				</ei:ConditionBehavior>
    			</i:Interaction.Behaviors>
    			<ei:GoToStateAction TargetObject="{Binding ElementName=button}" StateName="MoreState"/>
    		</ei:PropertyChangedTrigger>
    	</i:Interaction.Triggers>
        <Grid Margin="1">
            <ContentControl Hyperlink.RequestNavigate="ContentControl_RequestNavigate"  Content="{Binding CurrentNotification.TransformedData, Converter={StaticResource XamlConverter}}"  HorizontalAlignment="Stretch"/>
            <Button x:Name="button" Content="" HorizontalAlignment="Right" Margin="0,0,5,5" Style="{DynamicResource MoreButton}" VerticalAlignment="Bottom" Cursor="Hand" Command="{Binding ToggleTodoViewExpansionCommand}"/>
            <Button x:Name="DisableNotificationBtn" Click="DisableNotificationBtn_Click"  VerticalAlignment="Top" HorizontalAlignment="Right" Style="{StaticResource CloseButtonStyle}" Width="12" Height="12" Visibility="Collapsed"/>
        </Grid>
    </Border>
</UserControl>
